package com.jiaai.web.zfp_back.system;

import com.alibaba.dubbo.config.annotation.Reference;
import com.jiaai.exception.ServerException;
import com.jiaai.system.api.ILogApi;
import com.jiaai.system.model.LogQueryVO;
import com.jiaai.util.RestResultGenerator;
import org.springframework.web.bind.annotation.*;

/**
 * class_name:ZBLogController
 * describe:------------------>TODO
 * create_user:张昉平
 * create_date:2018/1/17
 * create_time:17:05
 */
@RestController
@RequestMapping("/api/v1/admin/log")
public class ZBLogController {

    @Reference
    private ILogApi iLogApi;

    @GetMapping("/list")
    public Object list(@RequestParam Integer curr, LogQueryVO vo){
        return RestResultGenerator.genSuccessResult(iLogApi.getAll(curr, vo));
    }

    @PostMapping("/deleteId")
    public Object deleteId(Integer id) throws Exception {
        try {
            iLogApi.deleteId(id);
            return RestResultGenerator.genSuccessResult("删除成功");
        } catch (Exception e) {
            throw new ServerException("删除失败");
        }
    }
}
